package com.example.dragandview.diyview;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;


import com.example.dragandview.R;

public class ABCindexViewActivity extends Activity implements ABCindexView.LetterTouchListener {
    private TextView tv_abc;
    private ABCindexView abcview;
    @Override
    protected void onCreate( Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.diy_abcindexview);
        tv_abc = findViewById(R.id.tv_abc);
        abcview = findViewById(R.id.abcview);
        abcview.setOnLetterTouchListener(this);
    }

    @Override
    public void touch(CharSequence letter, boolean isTouch) {
        if (isTouch){
            tv_abc.setVisibility(View.VISIBLE);
            tv_abc.setText(letter);
        }else {
            tv_abc.setVisibility(View.GONE);
        }

    }
}
